﻿using System.Messaging;
using NUnit.Framework;

namespace Patriq.Msmq.Router.Core.Tests
{
    [TestFixture]
    public class PythonScriptEngineTest
    {
        [Test]
        public void TestGetDestQueuePathByMessage()
        {
            var engine = new PythonScriptEngine("RouterScript.py", "TestStateScript.py");
            var method = engine.GetMethodByName("GetDestQueuePathByMessage");
            var message = new Message("Hello") { Label = "{\"Machine\": \"1\"" };
            var message2 = new Message("Hello");
            var message3 = new Message("Hello") { Label = "{\"Machine\": \"0\"" };
            var path = method(message);
            var path2 = method(message2);
            var path3 = method(message3);
            Assert.That(path, Is.EqualTo(@".\private$\default"));
            Assert.That(path2, Is.EqualTo(@".\private$\default"));
            Assert.That(path3, Is.EqualTo(@".\private$\other"));
        }
    }
}
